package com.gxa.community.admin.controller.bill;


import com.gxa.community.admin.service.bill.BillWithdrawService;
import com.gxa.community.core.pojo.dto.bill.BillWithdrawDto;
import com.gxa.community.core.pojo.dto.bill.storage.BillWithdrawStorageDto;
import com.gxa.community.core.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;

/**
 * @author juran
 * @since 2022-07-19
 */
@RestController
@RequestMapping("/bill/Withdraw")
public class BillWithdrawController {
    //TODO 数据校验
    @Autowired
    BillWithdrawService billWithdrawService;

    @PostMapping("addWithdrawInfo")
    public R addWithdrawInfo(@RequestBody BillWithdrawStorageDto billWithdrawStorageDto){
        return billWithdrawService.addWithdrawInfo(billWithdrawStorageDto);
    }

    @PostMapping("queryWithdrawInfo")
    public R queryWithdraInfo(@RequestBody BillWithdrawDto billWithdrawDto,
                            long page,
                            long size) {

        return billWithdrawService.queryWithdrawInfo(billWithdrawDto,
                ObjectUtils.isEmpty(page) ? 1 : page,
                ObjectUtils.isEmpty(page) ? 5 : size);
    }
}

